home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / BUSINESS / SALE24.ARJ / READTEST.PRG < prev    next >
Text File  |  1992-06-01  |  2KB  |  79 lines

  1. * PROCEDURE ReadTest
  2.  
  3. HIDE WINDOWS ALL
  4. @0,0 FILL TO SROWS(), SCOLS() COLOR SCHEME 5
  5. SET SYSMENU AUTO
  6. SET TALK OFF
  7. SET ESCAPE OFF
  8. * pick a file, any file...
  9. USE ?
  10. IF EMPTY(ALIAS())
  11.    RETURN
  12. ENDIF   
  13. * let's set up an attractive test screen
  14. BROWSE SAVE NOWAIT TITLE "Browse Window" 
  15. ACTIVATE WINDOW Calculator
  16. MOVE WINDOW Calculator TO 7,55
  17. ZOOM WINDOW Browse NORM AT 16,1 SIZE 5,50 
  18. DEFINE WIND Readwind1 ;
  19.        FROM 5,1 TO 8,50 TITLE "Read1"
  20. DEFINE WIND Readwind2 ;
  21.        FROM 10,1 TO 13,50 TITLE "Read2"
  22. ACTIVATE WINDOW Readwind1
  23. @ 0,2 EDIT x ;
  24.       DEFAULT REPL("One test. ",8) SIZE 2,44
  25. ACTIVATE WINDOW Readwind2
  26. @ 0,2 EDIT y ;
  27.       DEFAULT REPL("2nd test. ",9) SIZE 2,44
  28. WAIT WINDOW ;
  29.    "Pick different windows different ways "+ ;
  30.    "or press F2; ESC to end."
  31.  
  32. PUSH KEY CLEAR
  33.  
  34. * if you have a macro assigned to F2, change the
  35. * ON KEY LABEL F2 to some more convenient key 
  36. ON KEY LABEL F2 DO ReadTrial ;
  37.                    WITH "ON KEY LABEL"
  38. READ CYCLE ;
  39.      ACTIVATE ReadTrial("Activate",.t.) ;
  40.      DEACTIVATE ReadTrial("Deactivate",.f.) ;
  41.      WHEN ReadTrial("When",.t.) ;
  42.      VALID ReadTrial("Valid",LASTKEY()= 27) ;
  43.      SHOW ReadTrial("Show", .t.)    
  44.  
  45. * While the READ remains in force, all its
  46. * clauses as well as the ON KEY LABEL will
  47. * call ReadTrial() to let us know what happened
  48. * and the all-important sequence of events.
  49.  
  50. POP KEY     
  51. RELEASE WINDOWS "Browse", Readwind1, Readwind2
  52. SET COLOR OF SCHEME 5 TO
  53. SHOW WINDOWS ALL
  54. DEACTIVATE WINDOW Calculator
  55. RETURN
  56.  
  57. FUNCTION ReadTrial 
  58. PARAMETER whichclause, howreturn
  59.  
  60. * set up a string to tell us what happened
  61. whatcalls = whichclause + ;
  62.             IIF(PARAMETERS() = 2, ;
  63.                 " clause", " event")
  64.  
  65. * the color of the WAIT WINDOW uses SCHEME 5
  66. * -- this is just an additional clue to
  67. * what event occurred 
  68. SET COLOR OF SCHEME 5 TO SCHEME;
  69.          IIF(PARAMETERS() = 2,10,7)
  70.  
  71. WAIT WINDOW whatcalls+ ;
  72.      " -- Current: "+ WONTOP()+;
  73.      ", Past: "+ WLAST() + ;
  74.      " Get: "+ VARREAD()+ ;
  75.      "(" + ALLTRIM(STR(_CUROBJ))+")"
  76.  
  77. RETURN howreturn
  78.  
  79.